package com.lineage.data.item_armor;

import com.lineage.config.ConfigOther;
import com.lineage.data.executor.ItemExecutor;
import com.lineage.server.model.Instance.L1ItemInstance;
import com.lineage.server.model.Instance.L1PcInstance;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

public class ElitePlateMail_Lindvior extends ItemExecutor {
  private static final Log _log = LogFactory.getLog(ElitePlateMail_Lindvior.class);
  
  private int _r;
  
  private int _mp_min;
  
  private int _mp_max;
  
  public static ItemExecutor get() {
    return new ElitePlateMail_Lindvior();
  }
  
  public void execute(int[] data, L1PcInstance pc, L1ItemInstance item) {
    try {
      if (item == null)
        return; 
      if (pc == null)
        return; 
      if (item.getEnchantLevel() >= 0 && item.getEnchantLevel() <= 6) {
        this._r = ConfigOther.LINDVIOR_RANDOM_6;
        this._mp_min = ConfigOther.LINDVIOR_MIN_6;
        this._mp_max = ConfigOther.LINDVIOR_MAX_6;
      } else if (item.getEnchantLevel() == 7) {
        this._r = ConfigOther.LINDVIOR_RANDOM_7;
        this._mp_min = ConfigOther.LINDVIOR_MIN_7;
        this._mp_max = ConfigOther.LINDVIOR_MAX_7;
      } else if (item.getEnchantLevel() == 8) {
        this._r = ConfigOther.LINDVIOR_RANDOM_8;
        this._mp_min = ConfigOther.LINDVIOR_MIN_8;
        this._mp_max = ConfigOther.LINDVIOR_MAX_8;
      } else if (item.getEnchantLevel() >= 9) {
        this._r = ConfigOther.LINDVIOR_RANDOM_9;
        this._mp_min = ConfigOther.LINDVIOR_MIN_9;
        this._mp_max = ConfigOther.LINDVIOR_MAX_9;
      } 
      switch (data[0]) {
        case 0:
          pc.set_elitePlateMail_Lindvior(0, 0, 0);
          break;
        case 1:
          pc.set_elitePlateMail_Lindvior(this._r, this._mp_min, this._mp_max);
          break;
      } 
    } catch (Exception e) {
      _log.error(e.getLocalizedMessage(), e);
    } 
  }
}
